var happy = {
    phone: function (val) {
        return /^1[3|4|5|8][0-9]\d{4,8}$/.test(val);
    },
    
    idcard: function (val) {
        return /^\d{10}[0-9 a-z]+$/i.test(val);
    },    

    //yyyy-mm-dd
    date: function (val) {
        return /^[1-2][0-9]{3}\-[0-1][0-9]\-[0-3][0-9]$/.test(val);
    },

    email: function (val) {
        return /^(?:\w+\.?\+?)*\w+@(?:\w+\.)+\w+$/.test(val);
    },

    minLength: function (val, length) {
        return val.length >= length;
    },

    maxLength: function (val, length) {
        return val.length <= length;
    },

    equal: function (val1, val2) {
        return (val1 == val2);
    },
    
    digit: function (val) {
    	return /^\d+$/.test(val);
    },
    
    url: function (val) {
    	return /^(http:\/\/)?([^\/]+)/i.test(val);
    }
};
